/**
 * Copyright (C) 2011  Robin Dietrich, Nils Kenneweg, Leonard Stutz
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 **/ 

#include "3_dirt.hpp"

namespace minecraft {
    dirt::dirt() {
        //set id
        this->id = 3;
        
        //create material and texture for this block
        Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create(this->getTextureName(), "minecraft");
        Ogre::Technique* tech = mat->getTechnique(0);
        Ogre::Pass* pass = tech->getPass(0);
        Ogre::TextureUnitState* tex = pass->createTextureUnitState();
        tex->setTextureName("grass2.png");
        tex->setNumMipmaps(4);
        tex->setTextureAnisotropy(1);
        tex->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_POINT);
    }

    dirt::~dirt() {
        //remove material and texture for this block
        Ogre::MaterialManager::getSingleton().remove(this->getTextureName());
    }
}
